﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Eneta.Portal.Common
{
    /// <summary>
    /// Class for user action messages. This class provides messages to 
    /// show to the user after action is finished.
    /// </summary>
    public class ActionResult
    {
        /// <summary>
        /// Action result message to show in the UI
        /// </summary>
        /// <param name="action">Action result identificator.</param>
        /// <param name="result">Action result message.</param>
        /// <returns>true, if action was successful; false, when action was unsuccessful</returns>
        public static bool Message(string action, out string result)
        {
            if (string.IsNullOrEmpty(action)) {
                result = string.Empty;
                return false;
            }
            else
            {
                switch (action.ToLower())
                {
                    case "compadd":
                        result = "Firma on edukalt salvestatud ja ilmub peale administraatori<br/>kinnitamist.";
                        return true; 
                    case "compsave":
                        result = "Firma andmed on edukalt salvestatud!"; 
                        return true;
                    case "blogadd":
                        result = "Blogi on edukalt salvestatud ja ilmub peale administraatori<br/>kinnitamist.";
                        return true;
                    case "blogsave":
                        result = "Blogi andmed on edukalt salvestatud!";
                        return true;
                    case "annsave":
                        result = "Teade on edukalt salvestatud ja ilmub peale administraatori<br/>kinnitamist.";
                        return true;
                    case "annedit":
                        result = "Teade on edukalt muudetud!";
                        return true;
                    case "booksave":
                        result = "Raamat on edukalt salvestatud ja ilmub peale administraatori<br/>kinnitamist.";
                        return true;
                    case "bookedit":
                        result = "Raamat on edukalt salvestatud!";
                        return true;
                    case "magazinesave":
                        result = "Ajakiri on edukalt salvestatud ja ilmub peale administraatori<br/>kinnitamist.";
                        return true;
                    case "magazineedit":
                        result = "Ajakiri on edukalt salvestatud!";
                        return true;
                    case "evtedit":
                    case "evtsave":
                        result = "Sündmus on edukalt salvestatud!";
                        return true;
                    case "saved":
                        result = "Profiili andmed on edukalt salvestatud!";
                        return true;
                    case "joined":
                        result = "Aitäh Sulle, kasutaja on edukalt loodud. Palun täida oma profiil<br/>lõpuni, et osaleda Eneta portaalis täisväärtusliku liikmena.";
                        return true;
                    case "missingflds":
                        result = "Palun täida oma profiil kohustuslikud väljad.";
                        return false;
                    default:
                        result = string.Empty;
                        return false;
                }
            }
        }
    }
}
